

package com.hazelcast.internal.util.scheduler;

import com.hazelcast.spi.impl.executionservice.TaskScheduler;

/**
 * Factory for EntryTaskSchedulers.
 */
public final class EntryTaskSchedulerFactory {

    private EntryTaskSchedulerFactory() {
    }

    /**
     * Creates a new EntryTaskScheduler that will run all second operations in bulk.
     * Imagine a write-behind map where dirty entries will be stored in bulk.
     * EntryTaskScheduler implementation is thread-safe.
     *
     * @param taskScheduler  executor instance to execute the second
     * @param entryProcessor bulk processor
     * @return EntryTaskScheduler that will run all second operations in bulk
     */
    public static <K, V> EntryTaskScheduler<K, V> newScheduler(TaskScheduler taskScheduler, ScheduledEntryProcessor<K, V> entryProcessor, ScheduleType scheduleType) {
        return new SecondsBasedEntryTaskScheduler<>(taskScheduler, entryProcessor, scheduleType);
    }

}
